<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
<ul>
    <li id="li">1</li>
    <li id="li">2</li>
    <li id="li">3</li>
    <li class="li">4</li>
    <li class="li">5</li>
    <li class="lis">6</li>
    <li title="">7</li>
    <li id="box">8</li>
    <li id="a1">9</li>
    <li id="a2">10</li>
    <li class="lias">11</li>
    <li class="" id="">12</li>
</ul>
<script src="js/jquery-3.6.0.js"></script>
<script>
$(function(){
   //$('ul li[id]').css('background','green'); 
   //$('ul li[title]').css('background','blue'); 
   //$('ul li[id=box]').css('background','green'); 
   //$('ul li[id!=box]').css('background','green'); 
   //$('ul li[id^=a]').css('background','green'); 
   //$('ul li[class$=s]').css('background','green');
   //$('ul li[class*=l]').css('background','green');  
   $('ul li[id][class]').css('background','green');  //ul li 必须同时拥有id和class
})
</script>
</body>
</html>